from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
# Create your models here.

class Expense(models.Model):
    amount = models.FloatField(null=False)
    date = models.DateField(null=False)
    description = models.TextField(default='')
    category = models.CharField(max_length=255, null=False)
    owner = models.ForeignKey(to=User, on_delete=models.CASCADE, null=False)

    class Meta:
        verbose_name = '支出记录'
        verbose_name_plural = verbose_name

class Category(models.Model):
    name = models.CharField(max_length=255, null=False)

    def __str__(self):
        return self.name

    class Meta:
        verbose_name = '类型'
        verbose_name_plural = verbose_name
